<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Quản lí thông tin cá nhân</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="../script/jquery.js"></script>
<script type="text/javascript" src="../script/jquery.validate.min.js"></script>
<script type="text/javascript" src="../script/jsDatePick.jquery.min.1.3.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="../css/jsDatePick_ltr.min.css" />
<script type="text/javascript">
		window.onload = function(){
    		new JsDatePick({
    			useMode:2,
    			target:"dob",
    			dateFormat:"%Y-%m-%d"
    		});
        };
</script>

<style media="all" type="text/css">
@import "../css/all.css";
</style>
</head>
<body>
<div id="main">

    <?php
        $page = 0;
        include "../admin/header.php";  
        include "../service/userService.php";
    ?>  
  <div id="middle">
    <div id="left-column">
      <h3>Chức năng</h3>
      <ul class="nav">
        <?php
        //Admin function
        if($loggedInUser[2] == 1){
                echo "<a href='../admin/administration.php'>Quản lí thông tin cho admin</a>";
        }
        ?>
        <?php
        //Mod funtion
        if($loggedInUser[2] == 2){
            echo "<a href='../admin/mod.php'>Quản lí thông tin cho mod</a>";
        }
        ?>
        <?php
        //Company function
        if($loggedInUser[2] == 3){
            echo "<a href='../pc/recruitments.php'>Đăng tin tuyển dụng</a>";
        }
        ?>
        <?php
        //User function
        if($loggedInUser[2] == 4){
            echo "<a href='../pc/searchRecruitments.php'>Tìm kiếm tin tuyển dụng</a>";
        }
        ?>
      </ul>
       
      </div>
    <div id="center-column">
      <div class="top-bar">
        <h1>Personal Information</h1>
      </div>
      <br />
      <?php
        $type = $loggedInUser[2];
        $infor = null;
                    if ($type == 1)
                        $infor = mysql_fetch_array(getAdminInfor($loggedInUser[1]));
                    if ($type == 2)
                        $infor = mysql_fetch_array(getModInfor($loggedInUser[1]));
                    if ($type == 3)
                        $infor = mysql_fetch_array(getCompanyInfor($loggedInUser[1]));
                    if ($type == 4)
                        $infor = mysql_fetch_array(getUserInfor($loggedInUser[1]));
      ?>
      <div class="table"> <img src="img/bg-th-left.gif" width="8" height="7" alt="" class="left" /> <img src="img/bg-th-right.gif" width="7" height="7" alt="" class="right" />
      <form id="updateForm" action="../action/updateInformation.php" method="POST">
        <table class="listing form" cellpadding="0" cellspacing="0">
          <tr>
            <th class="full" colspan="2"><?php echo $loggedInUser[1]; ?></th>
          </tr>
          <tr>
            <td class="first" width="172"><strong>Giới tính <?php echo $type == 3?"(người đại diện)":""; ?></strong></td>
            <td class="last">
                <input type="radio" name="gender" id="gender" value="1" <?php echo $infor["USER_SEX"]==1?"checked='checked'":""; ?>/>Nam
                <input type="radio" name="gender" id="gender" value="0" <?php echo $infor["USER_SEX"]==0?"checked='checked'":""; ?>/>Nữ
            </td>
          </tr>
          <tr class="bg">
            <td class="first"><strong>Điện thoại</strong></td>
            <td class="last"><input type="text" class="text" name="telephone" id="telephone"  value="<?php echo $infor["USER_PHONE"]; ?>"/></td>
          </tr>
          <tr>
            <td class="first"><strong>Địa chỉ liên lạc</strong></td>
            <td class="last"><input type="text" class="text" name="address" id="address" value="<?php echo $infor["USER_ADD"]; ?>"/></td>
          </tr>
          <tr class="bg">
            <td class="first"><strong>Email</strong></td>
            <td class="last"><input type="text" class="text" name="email" id="email" value="<?php echo $infor["USER_EMAIL"]; ?>"/></td>
          </tr>
          <tr>
            <td class="first"><strong>Miêu tả</strong></td>
            <td class="last"><textarea name="description" id="description" style="width: 300px; height: 200px;"><?php echo $infor["USER_DESCRIPTION"]; ?></textarea></td>
          </tr>
          <tr class="bg">
            <td class="first"><strong>
            <?php
                    if ($type == 1)
                        echo "Birthday";
                    if ($type == 2)
                        echo "Birthday";
                    if ($type == 3)
                        echo "Foundation Day";
                    if ($type == 4)
                        echo "Birthday";
            ?>
            </strong></td>
            <td class="last"><input type="text" class="text" name="dob" id="dob" value="<?php echo $type == 3?$infor["FOUNDING_DATE"]:$infor["DOB"]; ?>" /></td>
          </tr>
          <tr>
            <td class="first"><strong>Ngày tham gia</strong></td>
            <td class="last"><input disabled="disabled" type="text" class="text" value="<?php echo $infor["USER_CREATEDATE"]; ?>" /></td>
          </tr>
        </table>
        
        <input type="hidden" name="id" id="id" value="<?php echo $loggedInUser[0]; ?>" />
        <input type="hidden" name="type" id="type" value="<?php echo $loggedInUser[2]; ?>" />
        </form>
        <div class="top-bar">
        <a href="#" class="button" onclick="document.forms['updateForm'].submit();">Cập nhật</a>
        </div>
        <p>&nbsp;</p>
      </div>
    </div>
    <div id="right-column"> <strong class="h">Ghi chú</strong>
      <div class="box">Hiển thị thông tin cá nhân của thành viên.</div>
    </div>
  </div>
  <?php include "../admin/footer.php";?>
</div>
</body>
</html>